import 'dart:io';
import 'dart:async';
import 'package:dio/dio.dart';
import 'package:http_parser/http_parser.dart';

class DriveConsts {

  /// 批量上传
  Future? uploadPics(List<File> pics) {
    /// 先初始化一个
    FormData formData = FormData.fromMap({
      'file': MultipartFile.fromFileSync(pics.first.path,
          contentType: MediaType.parse("image/jpeg"))
    });
    for (var i = 1; i < pics.length; i++) {
      formData.files.add(MapEntry(
          'file',
          MultipartFile.fromFileSync(pics[i].path,
              contentType: MediaType.parse("image/jpeg"))));
    }
    return null;



    // return HttpUtils()
    //     .post(Constant.API_HOST_OTTHER() + Api.uploadFile, data: formData)
    //     .then((res) {
    //   if (res['state'] != 200) throw res['subMsg'] ?? res['msg'] ?? '上传图片异常';
    //   return res['results'] ?? [];
    // });
  }
}
